class Solution:
    def partitionDisjoint(self, A: list) -> int:
        partition = (1, 0)
        left_max = A[0]
        right_max = A[0]
        for i in range(1, len(A)):
            if A[i] < left_max:
                partition = (partition[0] + partition[1] + 1, 0)
                left_max = right_max
            else:
                partition = (partition[0], partition[1] + 1)
                right_max = max(A[i], right_max)

        return partition[0]
